home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 September / Ahoy_Magazine_85-09_1985_Double_L.d64 / dice simulator (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  602b  |  25 lines

  1. 0 rem << rr21-1 >>
  2. 1 print"[147]":poke53280,3:poke53281,6
  3. 2 rem -- dice simulator --
  4. 3 rem  rupert report #21
  5. 4 rem
  6. 5 print "   randomly simulate the outcome for         rolling three dice..."
  7. 6 rem outcomes for rolling three dice
  8. 7 for d=1to2000:next
  9. 8 rem >>determine the probability that
  10. 9 rem   the sum is eleven
  11. 10 n=1 : r$=chr$(18) :rem rvs on
  12. 20 print chr$(147);
  13. 30 print tab(15)r$;"<< # rolls "
  14. 40 print tab(15)r$;"<< # success "
  15. 50 print tab(15)r$;"<< % probability "
  16. 60 a=int(rnd(0)*6)+1
  17. 70 b=int(rnd(0)*6)+1
  18. 80 c=int(rnd(0)*6)+1
  19. 90 ttl=a+b+c
  20. 100 if ttl=11 then sxcs=sxcs+1
  21. 110 print chr$(19);n : print sxcs
  22. 120 prob=100*sxcs/n : print prob
  23. 130 n=n+1
  24. 140 goto 60
  25.